Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:[CI-15236]: Added IMAGE_TAR_PATH as output variable for the plugin. #132

Merged
merged 17 commits into from
Nov 28, 2024

Conversation

Anshika2203
Copy link
Contributor

@Anshika2203 Anshika2203 commented Nov 18, 2024

IMAGE_TAR_PATH is now accessible via a output variable and can also be used in STO steps as expression -
<+steps.STEP_ID.output.outputVariables.IMAGE_TAR_PATH>

Screenshot 2024-11-18 at 4 37 36 PM

@Anshika2203 Anshika2203 changed the title feat:[CI-15236]: Added PLUGIN_TAR_PATH as output variable for the plugin. feat:[CI-15236]: Added IMAGE_TAR_PATH as output variable for the plugin. Nov 18, 2024
Copy link
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a validation check to ensure the directory for plugin_tar_path exists before use by making use of filepath.Dir, you can add this in if p.Build.TarPath != ""

also add some ut's to cover the same functionality for edge scenarios like in case of privileged and non-privileged k8s scenarios

pkg/output/output.go Outdated Show resolved Hide resolved
pkg/output/output.go Outdated Show resolved Hide resolved
Copy link
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI jobs are failing with the below error though it succeeds in local - remove the use /root dir in the tests, and may be rely on DRONE_WORKSPACE as it's common for both Drone and Harness or better use os.MkdirTemp

go: downloading golang.org/x/text v0.3.7
Warning: tar_path is empty
--- FAIL: TestTarPathValidation (0.00s)
    --- FAIL: TestTarPathValidation/invalid_path_no_permissions (0.00s)
        kaniko_test.go:239: Expected empty tar path, got non-empty string
FAIL
FAIL	github.com/drone/drone-kaniko	0.006s
ok  	github.com/drone/drone-kaniko/cmd/kaniko-acr	0.005s
ok  	github.com/drone/drone-kaniko/cmd/kaniko-docker	0.004s
?   	github.com/drone/drone-kaniko/cmd/kaniko-gar	[no test files]
ok  	github.com/drone/drone-kaniko/cmd/kaniko-ecr	0.011s
?   	github.com/drone/drone-kaniko/cmd/kaniko-gcr	[no test files]
ok  	github.com/drone/drone-kaniko/pkg/artifact	0.002s
ok  	github.com/drone/drone-kaniko/pkg/docker	0.004s
--- FAIL: TestWritePluginOutputFile (0.01s)
    --- FAIL: TestWritePluginOutputFile/invalid_output_path (0.00s)
        output_test.go:87: Expected error, got none
FAIL
FAIL	github.com/drone/drone-kaniko/pkg/output	0.011s

kaniko.go Outdated Show resolved Hide resolved
removed as getTarPath is only called when tarPath isn't empty
@Ompragash Ompragash merged commit e6ab8aa into drone:main Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants